<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="nav-close"><i class="fa fa-times-circle"></i>
    </div>
    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <span style="width: 51px;height: 51px;float: left;display: inline-block;margin-right: 10px;"><img alt="image" class="img-circle" src="../static/imgs/leftmenu/logo.png" /></span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#" style="height:51px; line-height:25px;">
                                <span class="clear">
                       <span class="block m-t-xs" style="color:#fff;" margin-top:0;><strong class="font-bold">用户名</strong></span>
                       <span class="text-muted text-xs block"> {%$admin_name%}<b class="caret"></b></span>
                                </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                
                                <li><a href="/logout">安全退出</a>
                                </li>
                            </ul>
                </div>
                <div class="logo-element">去乐园
                </div>
            </li>
            
            {%foreach $menus as $item%}
                <li>
                    <a href="{%$item.url%}">
                        <!-- <i class="fa fa-home"></i> -->
                        <span class="nav-label">{%$item.label%}</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level collapse">
                        {%foreach $item.items as $items%}
                            <li class="">
                                <a href="{%$items.url[0]%}">{%$items.label%}</a>
                            </li>
                        {%/foreach%}
                    </ul>
                </li>
            {%/foreach%}


        </ul>
    </div>
</nav>
<script type="text/javascript">
    var menu_btn = $("#side-menu > li > a"); 
    var menu_btn2 = $("#side-menu > li > ul > li > a"); 
    var winUrl = window.location.pathname;
    menu_btn.each(function(index , menuFirstA){
        if($(this).attr("href").indexOf(winUrl) == 0 ){
            $(this).parent("li").addClass("active");
        }else{
            menu_btn2.each(function(index , menuFirstA){
                if($(this).attr("href").indexOf(winUrl) == 0 ){
                    $(this).parent("li").addClass("active").parent().parent("li").addClass("active");
                    return false;
                }else{
                    // alert("1111");
                }
            });
        }
    });
</script>